/**
 * 
 */
package fr.ece.ing4.chatapplication.api;

import java.io.Serializable;

import org.jgroups.Address;

/**
 * @author enzo
 *
 */

public class ChatMessage implements Serializable{
	private Address source;
	private Address destination;
	private String clusterName;
	private int type;
	private int flag;
	private String data;
	//types
	public static final int REQUEST=0;
	public static final int ACK=1;
	public static final int NOTIF=2;
	public static final int CHAT=3;
	
	// flags
	public static final int CONNECT=0;
	public static final int CREA=1;
	public static final int JOIN=2;
	public static final int LEAVE=3;
	public static final int KICK=4;
	public static final int CHATROOMS=5;
	public static final int USERS=6;
	public static final int SEND=7;
	public static final int RECV=8;
	
	public ChatMessage(Address s, Address Addr, String cluster, int t, int f, String data)
	{
		source=s;
		destination=Addr;
		clusterName=cluster;
		type=t;
		flag=f;
		this.data=data;
	}

	/**
	 * @return the source
	 */
	public Address getSource() {
		return source;
	}

	/**
	 * @return the destination
	 */
	public Address getDestination() {
		return destination;
	}

	/**
	 * @return the clusterName
	 */
	public String getClusterName() {
		return clusterName;
	}

	/**
	 * @return the type
	 */
	public int getType() {
		return type;
	}

	/**
	 * @return the flag
	 */
	public int getFlag() {
		return flag;
	}

	/**
	 * @return the data
	 */
	public String getData() {
		return data;
	}

}
